<?php
echo "计算输入的两个数据的加减乘除的结果\n";
echo "请输入两个数据，用英文逗号分隔：\n";
$count = fscanf(STDIN, "%f ,%f %s", $a, $b, $other);
//var_dump($count,$a,$b,$other);
if($count>2){
    echo "输入的数据后边不要有乱七八糟的东西~\n";
}else if ($count == 2) { //成功接收两个数据
    $he = $a + $b;
    $cha = $a - $b;
    echo "$a + $b = $he\n";
    echo "$a - $b = $cha\n";
}else{ //没有成功接收两个数据
    echo "数据输入错误，请按要求的格式进行输入~\n";
}
